import { toRefs, reactive } from 'vue';

function CityHook() {
    const state = reactive({
        num: 3,
        toChange() {
            let num = state.num;
            var timer = setInterval(() => {
                num--
                if (num >= 0) {  
                    state.num = num;
                }else{
                    
                    clearInterval(timer)
                    state.num = 3
                }
            }, 1000);
            
        }
    })


    const refState = toRefs(state);
    return refState
}
export default CityHook